<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Query employees</title>
</head>

<body>
<h1>Query results</h1>
<%
    String name = request.getParameter("name");
    if (name==null)
       name = "";
%>
<form name="queryForm" action="query" method="get">
<p>Filter: <input name="name" type="text" id="name" value="<%=name%>" maxlength="50" />
<input type="submit" name="Submit" id="button" value="Query" /></p>
</form>
<table border="0" cellpadding="3" cellspacing="0">
	<tr>
		<td width="200" bgcolor="#CCCCCC">ID</td>
		<td width="80" bgcolor="#CCCCCC">Name</td>
        <td width="100" bgcolor="#CCCCCC">Title</td>
        <td width="60" bgcolor="#CCCCCC">Gender</td>
        <td width="70" bgcolor="#CCCCCC">Birth</td>
        <td width="16" bgcolor="#CCCCCC"></td>
	</tr>
	<%
	java.util.List<org.expressme.employee.mgmt.Employee> list = (java.util.List<org.expressme.employee.mgmt.Employee>) request.getAttribute("result");
	for (org.expressme.employee.mgmt.Employee em : list) {
	%>
	<tr>
		<td><%=em.getId()%></td>
		<td><%=em.getName()%></td>
        <td><%=em.getTitle()%></td>
        <td><%=em.isGender() ? "Male" : "Female"%></td>
        <td><%=new java.text.SimpleDateFormat("yyyy-MM-dd").format(em.getBirth())%></td>
        <td><a href="delete?id=<%=em.getId()%>" title="Delete">X</a></td>
	</tr>
	<%}%>
</table>
<p><a href="add.htm">Add new employee</a></p>
</body>
</html>
